<?php

namespace App\Http\Requests\System;

use App\Http\Controllers\Api\V1\SystemController;
use App\Http\Requests\AbstractBaseRequest;
use Illuminate\Validation\Rule;

class UploadImagesRequest extends AbstractBaseRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = [
            'scene' => ['required', 'string', Rule::in(array_keys(SystemController::$dictionaries))],
        ];
//        if ($this->scene == 1) {
//            $rules['image'] = 'required|image|dimensions:min_width=100,min_height=100|max:5120';
//        } else {
        $rules['image'] = 'required|image|max:5120';
//        }
        return $rules;
    }

    public function attributes()
    {
        return [
            'scene' => trans('图片使用场景'),
            'image' => trans('上传图片')
        ];
    }

    public function messages()
    {
        return [
            'image.dimensions' => trans('图片的清晰度不够，宽和高需要100px以上'),
        ];
    }
}
